package com.bitBusy.manageyourriches.database.contactClasses;

import java.util.List;
import java.util.Locale;



public class SpendingCategory implements Comparable<SpendingCategory>
{

	private String name;
	private List<SpendingSubcategory> subcategories;
	private int picResID;
	
	public SpendingCategory(String the_name, int the_id, List<SpendingSubcategory> the_subcategories)
	{
		name = the_name;
		picResID = the_id;
		subcategories = the_subcategories;
	}
	

	
	public String getName()
	{
		return name;
	}
	
	public List<SpendingSubcategory> getSubcategories()
	{
		
		return subcategories;
	}
	
	public int getPicID()
	{
		return picResID;
	}
	/** Method to set the subcategories list of the category
	 * @param list of subcategories for this category
	 */
	public void addSubcategories(List<SpendingSubcategory> the_subcategories)
	{
		subcategories = the_subcategories;
	}

	public int compareTo(SpendingCategory the_category) {
		
		if (the_category != null && the_category.getName() != null && this.name != null)
		{
			String nameOfMe = name.toLowerCase(Locale.ENGLISH);
			String nameOfOther = the_category.getName().toLowerCase(Locale.ENGLISH);
			return nameOfMe.compareTo(nameOfOther);
		}
		return 0;
	}
	
}
